<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\helpers\Url;

/* @var $this yii\web\View */
/* @var $model app\models\ProjectComment */

$this->title = '评论详情';
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', '评论管理'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="project-comment-view box box-primary">
    <!-- <div class="box-header">
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary btn-flat']) ?>
        <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger btn-flat',
            'data' => [
                'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
                'method' => 'post',
            ],
        ]) ?>
    </div> -->
    <?php 
        $actionDom = '';
        $lable = $model->is_top == 1 ? \Yii::t('app', '取消置顶') : \Yii::t('app', '置顶');
        $actionDom .= Html::a(
            $lable,
            Url::to(['set-top', 'id' => $model['id'], 'is_top' => $model->is_top == 1? 0 : 1]),
            [
                'data'  => [
                    'pjax' => 0,
                    'confirm' => '确定要'.$lable.'?',
                ],
                'class' => 'btn btn-warning btn-xs'
            ]
        );

        $lable = $model->is_read_by_self == 1 ? \Yii::t('app', '所有人可见') : \Yii::t('app', '仅自己可见');
        $actionDom .= Html::a(
            $lable,
            Url::to(['make-see', 'id' => $model['id'], 'is_read_by_self' => $model->is_read_by_self == 1? 0 : 1]),
            [
                'data'  => [
                    'pjax' => 0,
                    'confirm' => '确定要'.$lable.'?',
                ],
                'class' => 'btn btn-danger btn-xs'
            ]
        );
        echo  Html::tag('div', Html::tag('div', $actionDom, ['class' => 'btn-group']), ['class' => 'box-header']);
     ?>

    <div class="box-body table-responsive no-padding">
        <?= DetailView::widget([
            'model' => $model,
            'attributes' => [
                'id',
                'project_id',
                'userid',
                'content:html',
                'star',
                [
                    'attribute'=>'picture',
                    'format'=>'raw',
                    'value'=>function($model){
                        return $model->getPictrues($model->picture);
                    }
                ],
                [    
                    'options' => ['width' => '110px'],
                    'attribute' => 'is_top',
                    'format' => 'html',
                    'value'=>function($model){
                        return $model::getSetHotStatus($model['is_top']);
                    },
                ],
                [    
                    'options' => ['width' => '110px'],
                    'attribute' => 'is_read_by_self',
                    'format' => 'html',
                    'value'=>function($model){
                        return $model::getSelfSeeStatus($model['is_read_by_self']);
                    },
                ],
                'created_time:datetime',
                'updated_time:datetime',
            ],
        ]) ?>
    </div>
</div>
